package org.remixlab.gnutopic.client;

import java.util.ArrayList;
import java.util.Map;

import org.remixlab.gnutopic.data.XmlParser;

import processing.core.PApplet;

public class SearcherThread implements Runnable{

	private SpiralVisualization applet;
	private String query;
	
	public SpiralVisualization getApplet() {
		return applet;
	}

	public void setApplet(SpiralVisualization applet) {
		this.applet = applet;
	}
	
	public String getQuery() {
		return query;
	}

	public void setQuery(String query) {
		this.query = query;
	}

	@Override
	public void run() {
		//aqui llamo la función que realiza la búsqueda
		
		Map<String, ArrayList<Integer>> threads = XmlParser.getInstance().search(query);
		
		//modifico el hashMap de busqueda
		applet.setSearchResult(threads);
		
		applet.setFilter(true);
	}
	
}
